package com.cykj.pos.mapper;

import com.cykj.pos.domain.BizFeesCharged;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 流量费费用收取列Mapper接口
 *
 * @author xuxiaolong
 * @date 2022-04-29
 */
public interface BizFeesChargedMapper extends BaseMapper<BizFeesCharged> {

    List<BizFeesCharged> selectBizFeeCharged();

    /**
     *插入流量费用收取列表
     * @param bizFeesCharged
     */
    void insertBizFeesCharged(BizFeesCharged bizFeesCharged);

    @Update("update biz_fees_charged set rmb_status=2 where uuid=#{uuid}")
    void updateStau(String uuid);
    @Select("SELECT count(1) FROM `biz_fees_charged` bfc where  bfc.sn=#{posSn} and bfc.merchant_no=#{merchantNo}")
    int getFeeChargeServiceByPosCode(@Param("posSn") String posSn, @Param("merchantNo")String merchantNo);

    @Select("select * from biz_fees_charged where merchant_no=#{merchantNo} and  sn=#{sn} and host_date=#{hostDate}")
    BizFeesCharged getLklLlf(BizFeesCharged bizFeesCharged);
    @Select("select * from biz_fees_charged where new_order_no=#{newOrderNo}")
    BizFeesCharged selectNewOrderNo(String newOrderNo);

    @Select("select count(*) from biz_fees_charged where merchant_no=#{merchant_no} and sn = #{sn} and amt_type = '0'")
    int selectIsSecondSimAmt(@Param("merchant_no")String merchant_no,@Param("sn")String sn);

    BizFeesCharged selectCashbackAmountAll(@Param("merchId") Long merchId,@Param("channel") String channel);

    BizFeesCharged selectCashbackAmountAllUp(@Param("merchId") Long merchId,@Param("channel") String channel,
                                             @Param("startTime") String startTime,@Param("endTime") String endTime);
}
